<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container">

    <div class="navbar-header">
      <%= link_to "CourseSelect", root_path, class: 'navbar-brand' %>
    </div>

    <div class="collapse navbar-collapse">
      <ul class="nav navbar-nav">

        <li class=<%= "active" if params[:controller]=="homes" %>> <%= link_to "主页", root_path %></li>

        <% if student_logged_in? %>
            <li class=<%= "active" if params[:controller]=="courses" %>> <%= link_to "我的课程", courses_path %></li>
        <% elsif teacher_logged_in? %>
            <li class=<%= "active" if params[:controller]=="courses" %>> <%= link_to "课程管理", courses_path %></li>
        <% elsif admin_logged_in? %>
            <li> <%= link_to "控制面板", rails_admin_path %></li>
        <% end %>

      </ul>

      <ul class="nav navbar-nav navbar-right">

        <% if current_user %>
            <li>
              <%= link_to edit_user_path(current_user) do %>
                  <%= current_user.name %><span class="glyphicon glyphicon-user"></span>
              <% end %>
            </li>

            <li>
              <p class="navbar-text"><%= current_user.department %></p>
            </li>

            <li>
              <%= link_to sessions_logout_path, method: :delete do %>
                  退出 <span class="	glyphicon glyphicon-off"></span>
              <% end %>
            </li>

        <% else %>

            <li><%= link_to sessions_login_path do %>
                  登陆 <span class="	glyphicon glyphicon-user"></span>
              <% end %>
            </li>

            <li><%= link_to new_user_path do %>
                  注册 <span class="	glyphicon glyphicon-log-in"></span>
              <% end %>
            </li>
        <% end %>
      </ul>
    </div>
  </div>
</nav>




